package org.langcom.logic.constraint;

import java.util.Arrays;
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;


public abstract class AbstractCompositeConstraint<T> extends AbstractConstraint<T> implements ICompositeConstraint<T>{

	protected final List<IConstraint<T>> children = new LinkedList<IConstraint<T>>();

	protected AbstractCompositeConstraint(String description, String detailedDescription) {
		super(description, detailedDescription);
	}

	public ICompositeConstraint<T> add(IConstraint <T> ... constraints) {
		List<IConstraint<T>> list = Arrays.asList(constraints);
		children.addAll(list);
		return this;
	}

	public List<IConstraint<T>> getChildren() {
		return Collections.unmodifiableList(children);
	}

}
